package educationaladministrationsystem.CSM.Mapper.Root;

import educationaladministrationsystem.Class.Faculties;
import educationaladministrationsystem.Class.MajorProgram;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RootProfessionalManagementMapper {
    @Select("select * from faculties")
    List<Faculties> getAllFacultiesInformation();

    @Select("select name from faculties where id=#{id}")
    String getFacultiesName(String id);

    @Select("select * from majorprogram limit #{page},#{pageNumber}")
    List<MajorProgram> getAllProfessionMajor(int page, int pageNumber);

    @Insert("insert into MajorProgram values (#{id},#{name},#{sum},#{facultiesId})")
    void addNewProfessionMajor(MajorProgram majorProgram);

    @Select("select count(*) from majorprogram")
    int getPage();

    @Select("select * from majorprogram where id=#{id}")
    MajorProgram getUpdateProfessionMajorInformation(int id);

    @Update("update majorprogram set id=#{id},name=#{name},facultiesId=#{facultiesId} where id=#{oldId}")
    void updateProfessionMajor(String id, String name, String facultiesId, String oldId);

    @Delete("delete from majorprogram where id=#{id}")
    void deleteProfessionMajor(String id);

}
